package com.bzg.manager.utils;

import java.security.MessageDigest;

import com.bzg.manager.bean.User;

/**
 * Description:密码加密
 *
 * @author gmy
 * @date 2017年3月8日 下午1:07:40
 */
public class PasswordEnc {

	public static String encPassword(String  password) {
		MessageDigest md;
		try {
			md = MessageDigest.getInstance("SHA-256");


		byte[] hash = md.digest(password.getBytes("EUC-KR"));

		StringBuffer sb = new StringBuffer();

		for (int i = 0; i < hash.length; i++) {
			sb.append(Integer.toString((hash[i] & 0xff) + 0x100, 16).substring(1));
		}

		return sb.toString();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "";
	}
}